Component({
  properties: {
    dictType: {
      type: String,
      value: 'course'
    },
    courseDict: {
      type: Object,
      value: {}
    },
    cambridgeDict: {
      type: Object,
      value: {}
    }
  },

  data: {
    grade3Expanded: false,
    grade4Expanded: false,
    starterExpanded: false
  },

  methods: {
    switchDictType(e) {
      const type = e.currentTarget.dataset.type;
      this.setData({ dictType: type });
      this.triggerEvent('switchType', { type });
    },

    toggleGrade(e) {
      const grade = e.currentTarget.dataset.grade;
      const expandKey = `${grade}Expanded`;
      this.setData({
        [expandKey]: !this.data[expandKey]
      });
    },

    selectLesson(e) {
      const { grade, lesson } = e.currentTarget.dataset;
      this.triggerEvent('selectLesson', { grade, lesson });
    },

    selectUnit(e) {
      const { level, semester, unit } = e.currentTarget.dataset;
      this.triggerEvent('selectUnit', { level, semester, unit });
    }
  }
}); 